//
//  ByCellScoreStoreDetailAdvantage.m
//  mijifen_ios
//
//  Created by 朱凯 on 2017/11/8.
//  Copyright © 2017年 itboye. All rights reserved.
//

#import "ByCellScoreStoreDetailAdvantage.h"

@implementation ByCellScoreStoreDetailAdvantage
{
    UIImageView *_view1;
    UIImageView *_view2;
    UIImageView *_view3;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        self.backgroundColor = [UIColor clearColor];
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = @"蜜积分优势";
    titleLabel.font = FONT(18);
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:titleLabel];
    
    _view1 = [self imageViewWithTitle];
    _view2 = [self imageViewWithTitle];
    _view3 = [self imageViewWithTitle];
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@40);
        make.left.right.top.equalTo(@0);
    }];
    [_view2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH / 5.5, 100));
        make.centerX.equalTo(@0);
        make.top.equalTo(titleLabel.mas_bottom);
        
        make.bottom.equalTo(self.contentView).offset(-10);
    }];
    [_view1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(_view2.mas_left).offset(-SCREEN_WIDTH / 10);
        make.size.top.equalTo(_view2);
    }];
    [_view3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_view2.mas_right).offset(SCREEN_WIDTH / 10);
        make.size.top.equalTo(_view2);
    }];
}

- (UIImageView *)imageViewWithTitle {
    
    UIImageView *imageView = [UIImageView new];
    imageView.backgroundColor = BY_GOLD_COLOR;
    [self.contentView addSubview:imageView];
    
    UILabel *label = [[UILabel alloc] init];
    label.numberOfLines = 0;
    label.text = @"蜜\n积\n分\n优\n势";
    label.font = FONT(14);
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor blackColor];
    label.tag = 100;
    [imageView addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(imageView);
    }];
    
    return imageView;
}
@end
